﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Webcar.BLL;
using ToolsLayer;
using BusinessEntity;

namespace Webcar.Car
{
    public partial class SendCarPopView : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack) return;

            SetSendInfo(Request.QueryString["xh"]);
        }
        private void SetSendInfo(string sendno)
        {
            CarBLL cb = new CarBLL();
            BS_CAR_SENDEntity sendinfo = cb.GetCarSendInfo(sendno);
            PropertyBindings pb = new PropertyBindings();
            pb.EntityObject = sendinfo;
            this.SetBindingInfo(pb);
            pb.SetBindingObjectValue();
            //设置牌照号
            try
            {
                this.tbRecordNo.Text = cb.GetCar(sendinfo.CarNo).RECORD_NO;
            }
            catch
            {
            }
            InfoChecker ic = new InfoChecker();
            ic.SetInfoReaded(sendinfo.XH, InfoCheckType.CarSend);
        }
        private void SetBindingInfo(PropertyBindings pb)
        {
            pb.AddRelation(this.ddlDept, "DEPT_CODE");
            pb.AddRelation(this.tbChildDept, "Dept2");
            pb.AddRelation(this.tbJHr, "JHR");
            pb.AddRelation(this.tbSqr, "SQR");
            pb.AddRelation(this.tbNums, "USE_NUMS");
            pb.AddRelation(this.tbDriverName, "DriverName");
            pb.AddRelation(this.tbPzr, "CHECK_MAN");
            pb.AddRelation(this.dtStartDate, "START_DATE");
            pb.AddRelation(this.ddlJobKInd0, "JOB_KIND");
            pb.AddRelation(this.tbSendMan, "SEND_MAN");
            pb.AddRelation(this.dtReturnDate, "END_DATE");

            pb.AddRelation(this.tbWz, "material");
            pb.AddRelation(this.tbWzNums, "material_nums");
            pb.AddRelation(this.tbPlace, "PLACE");
            pb.AddRelation(this.tbReasons, "REASON");
            pb.AddRelation(this.tbAQ, "sec_cause");
            pb.AddRelation(this.tbRemark, "REMARK");
        }
    }
}
